import { configureStore, applyMiddleware } from '@reduxjs/toolkit'
import createSagaMiddleware from 'redux-saga'
import { jobSlice } from './reducers.js'
import { rootSaga } from './sagas.js'

const sagaMiddleware = createSagaMiddleware()

const store = configureStore({
  reducer: {
    job: jobSlice.reducer,
  },
  middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(sagaMiddleware),
})

sagaMiddleware.run(rootSaga)

export default store;
